package vivek.project.pocketmoney.mutualfund.model
{

	[Bindable]
	public class MutualFundTransactionScript
	{
		public function MutualFundTransactionScript()
		{
		}
		public var mt_account:int=0;
		public var mt_amount:Number=0;
		public var mt_available:Number=0;
		public var mt_channel:int=0;
		public var mt_date:Date=new Date();
		public var mt_folio:String="";
		public var mt_id:int=0;
		public var mt_nav:Number=0;
		public var mt_schemeid:Number=0;
		public var mt_txntype:int=0;
		public var mt_unit:Number=0;
		public var sm_fundid:int=0;
		public var sm_investtype:int=0;
		public var sm_schemename:String="";
		public var sm_schemetype:int=0;
		public var totalBuyValue:Number=0;
		public var totalProfit:Number=0;
		public function get amountInvested():Number
		{
			if (mt_txntype == 0)
				return mt_amount;
			return 0;
		}
		public function get available():Number
		{
			return mt_available;
		}
		public function set available(number:Number):void
		{
			mt_available=number;
		}
		public function get currentValue():Number
		{
			if (mt_txntype == 0)
				return mt_unit * MutualFundModel.getLatestNAVForScheme(mt_schemeid);
			return 0;
		}
		public function get profit():Number
		{
			if (mt_txntype == 0)
				return currentValue - amountInvested;
			return 0;
		}
		public function get redeemed():Number
		{
			if (mt_txntype == 1)
				return mt_amount;
			return 0.00;
		}
		public function get schemeName():String
		{
			return MutualFundModel.getSchemeNameById(mt_schemeid);
		}
	}
}